<?php
require_once("super-simple/functions.php");
//require_once("super-simple/sessionManager.php");
//checkSession();

$twitterObj = new EpiTwitter($twitterConsumerKey, $twitterConsumerSecret);

$twitterObj->setToken($_GET['oauth_token']);
$token = $twitterObj->getAccessToken();
$twitterObj->setToken($token->oauth_token, $token->oauth_token_secret);
$twitterInfo = $twitterObj->get_accountVerify_credentials();
$twitterInfo->response;
$userid = 5;

$_SESSION['token'] = $token->oauth_token;
$_SESSION['secret'] = $token->oauth_token_secret;
$_SESSION['twitterName'] = $twitterInfo->screen_name;


$success = update_network_token('twitter', $token->oauth_token, $token->oauth_token_secret, $twitterInfo->screen_name, $userid);

header("Location: ".FULL_PATH."index.php");
exit; 
} 
else {
	header("Location: index.php?ERROR");
	exit;
}

?>